package com.galangel.bookservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.galangel.bookservice.domain.pojo.BookCopy;
import com.galangel.bookservice.service.IBookCopyService;
import com.galangel.common.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 图书信息表 前端控制器
 * </p>
 *
 * @author galangel
 * @since 2025-03-15
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/book-copy")
public class BookCopyController {

    private final IBookCopyService bookCopyService;

    @GetMapping("/list")
    public R list() {
        return R.ok(bookCopyService.list());
    }

    @GetMapping("/{isbn}")
    public R get(@PathVariable String isbn) {
        return R.ok(bookCopyService.getOne(
                new QueryWrapper<BookCopy>().eq("isbn", isbn)
        ));
    }

}
